const Utils = {
    getValueByExp(data,exp){
        const copyKeys = exp.split('.');
        return this._getValueByKeys(data,copyKeys);
    },
    _getValueByKeys(data,copyKeys){
        const value = data[copyKeys.shift()];
        if(typeof value === 'undefined'){
            return typeof value;
        }
        if(!value){
            return '';
        }
        if(copyKeys.length === 0){
            return value;
        }else{
            return this._getValueByKeys(value,copyKeys);
        }
    },
    setValueByExp(data,exp,newValue){
        const copyKeys = exp.split('.');
        this._setValueByKeys(data,copyKeys,newValue);
    },
    _setValueByKeys(dataTree,keys,newValue){
        if(keys.length === 1){
            dataTree[keys.shift()] = newValue;
            return;
        }
        const fatherData = dataTree[keys.shift()];
        if(typeof fatherData === 'undefined'){
            return;
        }
        if(!fatherData){
            return;
        }
        this._setValueByKeys(fatherData,keys,newValue);
    },
    isComputed(vm,exp){
        return vm.computed[exp] !== undefined;
    }
}